/*
 * @Description: 灌溉控制
 */
import zhreq from "@/api/axios";
export default {
  /**
   * @description: 获取所拥有设施和灌溉控制
   * @param {String/Number} page
   * @param {String/Number} size
   */
  queryPageByCondition(params) {
    return zhreq.post('v3/iot/dataItem/group/queryPageByCondition', params)
  },
  /**
   * @description: 获取验证码
   */
  getcodeimg() {
    return zhreq.get("v3/organization/code/getCode");
  },
  /**
   * @description: 获取设施分组
   */
  queryByFacilityNo(params) {
    return zhreq.get(`v3/iot/dataItem/group/queryByFacilityNo?facilityNo=${params}`);
  },
  /**
   * @description: 查询设施状态
   */
  queryListById(dataItemIdList) {
    return zhreq.get(`v3/iot/dataCollectNew/queryListById?dataItemIdList=${dataItemIdList}`);
  },
  /**
   * @description: 获取设备开关状态
   * @param {Object}  *设施组或设施id
   */
  getshebeikiaguanstau(params) {
    return zhreq.get(`v3/iot/dataCollectNew/queryListById?dataItemIdList=${params.dataCollectNewId}`);
  },
  /**
   * @description: 控制设备组开关
   * @param {Object}  *设施组或设施id
   */
  setshebeikiaguanstau(params) {
    return zhreq.post("v3/iot/iotPlatform/rtuControl/remoteControl", params);
  },
  /**
   * @description: 控制设备开关
   * @param {Object}  *设施组或设施id
   */
  remoteControl(params) {
    return zhreq.post("v3/iot/dataItem/group/queue-control", params);
  },
  // 获取开启关闭数量
  countByFacilityNo(facilityNo) {
    return zhreq.get(`v3/iot/dataItem/group/countByFacilityNo?facilityNo=${facilityNo}&organizationNo=${sessionStorage.organizationNo}`);
  },
  // 获取开启关闭具体蝶阀
  queryByOperation (params) {
    let url = `v3/iot/dataItem/group/queryByOperation?organizationNo=${sessionStorage.organizationNo}&operation=${params.operation}`
    if (params.facilityNo) url += `&facilityNo=${params.facilityNo}`
    return zhreq.get(url);
  },
  // 查询正在执行的任务
  task (facilityNo) {
    let url = `v3/iot/dataItem/group/task?organizationNo=${sessionStorage.organizationNo}&facilityNo=${facilityNo}`
    return zhreq.get(url);
  },
};
